package com.itheima.service.impl;

import com.itheima.dao.UserDao;
import com.itheima.service.UserService;

import java.util.Date;

/**
 * @author by itheima
 * @Date 2022/4/21
 * @Description
 */
public class UserServiceImpl3 implements UserService {

    private String name;
    private int age;
    private String name1;
    private int age1;
    private UserDao dao;
    private Date date;


    /**
     * 先运行构造器方法，然后再运行init方法和销毁方法
     * 1
     */
    public UserServiceImpl3() {
        System.out.println("UserServiceImpl2 create .....");
    }

    @Override
    public void save() {
        System.out.println("UserService save run ....");
    }

    /**
     * 定义初始化方法
     * 方法名称随便定义
     * 2
     */
    public void initMethod(){
        //加载外部xml properties文件
        //发送邮件
        System.out.println("initMethod run.....");
    }

    /**
     * 定义销毁方法
     * 方法名称随便定义
     * 3
     */
    public void destroyMethod(){
        System.out.println("destroyMethod run.....");
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public void setDao(UserDao dao) {
        this.dao = dao;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public void setAddress(String address){
        System.out.println(address+"do nothing....");
    }

    public void setName1(String name1) {
        this.name1 = name1;
    }

    public void setAge1(int age1) {
        this.age1 = age1;
    }

    @Override
    public String toString() {
        return "UserServiceImpl3{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", dao=" + dao +
                ", date=" + date +
                '}';
    }
}
